#include "G.h"
#include "client/iclient.h"
#include "client/iwindow.h"
#include "debug/logger.h"

#include "messiah/resource/repo/repository.h"
#include "messiah/resource/world/iworld_manager.h"
#include "messiah/resource/repo/repo_item.h"
#include "messiah/resource/find_similar_texture.h"
#include "image/image_loader.h"

#include "repo_tools/repo_tools.h"

#include <algorithm>
#include <functional>

using namespace renderit;


static void test_event_input(const client::input_event& ievent)
{
	if (ievent.is_mouse_event() && ievent.event != client::EInputEvent_MouseMove)
	{
		logger::info("\tMouse Event(%d):%f, %f", ievent.event, ievent.u.mouse.x, ievent.u.mouse.y);
	}
	else if(ievent.is_key_event())
	{
		logger::info("\tKey Event(%d):%d", ievent.event, ievent.u.key.vk);
	}
}

int main(int argc, const char * argv[])
{
	renderit::create_G(argc, argv);
	
	renderit::G->client()->create_console("Test");
	renderit::client::iwindow * mwindow = renderit::G->client()->create_window(1024, 768, "RenderIt");

	if(1)
	{
		G->add_argument("package", "G:\\h42\\common\\resource\\Package\\");
	}

	// Do First Frame
	{
		mwindow->set_event_listener(test_event_input);
	}


	repo_tools game;
	if (0)
	{
		game.start_game();
	}	
	
	renderit::G->loop();

	return 0;
}